package com.monkey.luffer.springboot.demo.basis.designPatterns.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: dengkaibing
 * @Description:
 * @Date: 2021/2/3 10:18
 * @company 甜橙金融
 * @Version: 1.0
 */
public class DynamicProxyHandlerImpl<T> implements InvocationHandler {

    T t;

    public DynamicProxyHandlerImpl(T t) {
        this.t = t;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("买房前准备！");
        //执行业务方法
        T result =(T) method.invoke(t, args);
        System.out.println("买房后工作！");
        return result;
    }
}
